package com.education.mapper;

import com.education.domain.Tbclass;
import com.education.domain.TbclassExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbclassMapper {
    @SelectProvider(type=TbclassSqlProvider.class, method="countByExample")
    int countByExample(TbclassExample example);

    @DeleteProvider(type=TbclassSqlProvider.class, method="deleteByExample")
    int deleteByExample(TbclassExample example);

    @Delete({
        "delete from tbclass",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer lid);

    @Insert({
        "insert into tbclass (strClassName, lHeadmasterId, ",
        "lTermId, nGrade, ",
        "nState, dtCreatTime, ",
        "dtModifyTime)",
        "values (#{strclassname,jdbcType=VARCHAR}, #{lheadmasterid,jdbcType=INTEGER}, ",
        "#{ltermid,jdbcType=INTEGER}, #{ngrade,jdbcType=INTEGER}, ",
        "#{nstate,jdbcType=INTEGER}, #{dtcreattime,jdbcType=TIMESTAMP}, ",
        "#{dtmodifytime,jdbcType=TIMESTAMP})"
    })
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insert(Tbclass record);

    @InsertProvider(type=TbclassSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="lid")
    int insertSelective(Tbclass record);

    @SelectProvider(type=TbclassSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="strClassName", property="strclassname", jdbcType=JdbcType.VARCHAR),
        @Result(column="lHeadmasterId", property="lheadmasterid", jdbcType=JdbcType.INTEGER),
        @Result(column="lTermId", property="ltermid", jdbcType=JdbcType.INTEGER),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="nState", property="nstate", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<Tbclass> selectByExample(TbclassExample example);

    @Select({
        "select",
        "lId, strClassName, lHeadmasterId, lTermId, nGrade, nState, dtCreatTime, dtModifyTime",
        "from tbclass",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="lId", property="lid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="strClassName", property="strclassname", jdbcType=JdbcType.VARCHAR),
        @Result(column="lHeadmasterId", property="lheadmasterid", jdbcType=JdbcType.INTEGER),
        @Result(column="lTermId", property="ltermid", jdbcType=JdbcType.INTEGER),
        @Result(column="nGrade", property="ngrade", jdbcType=JdbcType.INTEGER),
        @Result(column="nState", property="nstate", jdbcType=JdbcType.INTEGER),
        @Result(column="dtCreatTime", property="dtcreattime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dtModifyTime", property="dtmodifytime", jdbcType=JdbcType.TIMESTAMP)
    })
    Tbclass selectByPrimaryKey(Integer lid);

    @UpdateProvider(type=TbclassSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Tbclass record, @Param("example") TbclassExample example);

    @UpdateProvider(type=TbclassSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Tbclass record, @Param("example") TbclassExample example);

    @UpdateProvider(type=TbclassSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Tbclass record);

    @Update({
        "update tbclass",
        "set strClassName = #{strclassname,jdbcType=VARCHAR},",
          "lHeadmasterId = #{lheadmasterid,jdbcType=INTEGER},",
          "lTermId = #{ltermid,jdbcType=INTEGER},",
          "nGrade = #{ngrade,jdbcType=INTEGER},",
          "nState = #{nstate,jdbcType=INTEGER},",
          "dtCreatTime = #{dtcreattime,jdbcType=TIMESTAMP},",
          "dtModifyTime = #{dtmodifytime,jdbcType=TIMESTAMP}",
        "where lId = #{lid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Tbclass record);
}